#include "napi/native_api.h"
#include "hilog/log.h"

static napi_value CreateNativeRoot(napi_env env, napi_callback_info info) {
    size_t argc = 2;
    napi_value args[2] = {nullptr};

    napi_get_cb_info(env, info, &argc, args, nullptr, nullptr);

    OH_LOG_Print(LOG_APP, LOG_DEBUG, LOG_DOMAIN, "test : %{public}s", "xxxx");

    return nullptr;
}
static napi_value Play(napi_env env, napi_callback_info info) {
    size_t argc = 2;
    napi_value args[2] = {nullptr};

    napi_get_cb_info(env, info, &argc, args, nullptr, nullptr);

    OH_LOG_Print(LOG_APP, LOG_DEBUG, LOG_DOMAIN, "test : %{public}s", "Play");

    return nullptr;
}
static napi_value Stop(napi_env env, napi_callback_info info) {
    size_t argc = 2;
    napi_value args[2] = {nullptr};

    napi_get_cb_info(env, info, &argc, args, nullptr, nullptr);

    OH_LOG_Print(LOG_APP, LOG_DEBUG, LOG_DOMAIN, "test : %{public}s", "Stop");

    return nullptr;
}
static napi_value TogglePause(napi_env env, napi_callback_info info) {
    size_t argc = 2;
    napi_value args[2] = {nullptr};

    napi_get_cb_info(env, info, &argc, args, nullptr, nullptr);

    OH_LOG_Print(LOG_APP, LOG_DEBUG, LOG_DOMAIN, "test : %{public}s", "TogglePause");

    return nullptr;
}
static napi_value Destroy(napi_env env, napi_callback_info info) {
    size_t argc = 2;
    napi_value args[2] = {nullptr};

    napi_get_cb_info(env, info, &argc, args, nullptr, nullptr);

    OH_LOG_Print(LOG_APP, LOG_DEBUG, LOG_DOMAIN, "test : %{public}s", "Destroy");

    return nullptr;
}
static napi_value Pause(napi_env env, napi_callback_info info) {
    size_t argc = 2;
    napi_value args[2] = {nullptr};

    napi_get_cb_info(env, info, &argc, args, nullptr, nullptr);

    OH_LOG_Print(LOG_APP, LOG_DEBUG, LOG_DOMAIN, "test : %{public}s", "Pause");

    return nullptr;
}
static napi_value GoToAndStop(napi_env env, napi_callback_info info) {
    size_t argc = 2;
    napi_value args[2] = {nullptr};

    napi_get_cb_info(env, info, &argc, args, nullptr, nullptr);

    OH_LOG_Print(LOG_APP, LOG_DEBUG, LOG_DOMAIN, "test : %{public}s", "GoToAndStop");

    return nullptr;
}
static napi_value GoToAndPlay(napi_env env, napi_callback_info info) {
    size_t argc = 2;
    napi_value args[2] = {nullptr};

    napi_get_cb_info(env, info, &argc, args, nullptr, nullptr);

    OH_LOG_Print(LOG_APP, LOG_DEBUG, LOG_DOMAIN, "test : %{public}s", "GoToAndPlay");

    return nullptr;
}
static napi_value SetSegment(napi_env env, napi_callback_info info) {
    size_t argc = 2;
    napi_value args[2] = {nullptr};

    napi_get_cb_info(env, info, &argc, args, nullptr, nullptr);

    OH_LOG_Print(LOG_APP, LOG_DEBUG, LOG_DOMAIN, "test : %{public}s", "SetSegment");

    return nullptr;
}
static napi_value ResetSegments(napi_env env, napi_callback_info info) {
    size_t argc = 2;
    napi_value args[2] = {nullptr};

    napi_get_cb_info(env, info, &argc, args, nullptr, nullptr);

    OH_LOG_Print(LOG_APP, LOG_DEBUG, LOG_DOMAIN, "test : %{public}s", "ResetSegments");

    return nullptr;
}
static napi_value Resize(napi_env env, napi_callback_info info) {
    size_t argc = 2;
    napi_value args[2] = {nullptr};

    napi_get_cb_info(env, info, &argc, args, nullptr, nullptr);

    OH_LOG_Print(LOG_APP, LOG_DEBUG, LOG_DOMAIN, "test : %{public}s", "Resize");

    return nullptr;
}
static napi_value SetSpeed(napi_env env, napi_callback_info info) {
    size_t argc = 2;
    napi_value args[2] = {nullptr};

    napi_get_cb_info(env, info, &argc, args, nullptr, nullptr);

    OH_LOG_Print(LOG_APP, LOG_DEBUG, LOG_DOMAIN, "test : %{public}s", "SetSpeed");

    return nullptr;
}
static napi_value SetDirection(napi_env env, napi_callback_info info) {
    size_t argc = 2;
    napi_value args[2] = {nullptr};

    napi_get_cb_info(env, info, &argc, args, nullptr, nullptr);

    OH_LOG_Print(LOG_APP, LOG_DEBUG, LOG_DOMAIN, "test : %{public}s", "SetDirection");

    return nullptr;
}
static napi_value PlaySegments(napi_env env, napi_callback_info info) {
    size_t argc = 2;
    napi_value args[2] = {nullptr};

    napi_get_cb_info(env, info, &argc, args, nullptr, nullptr);

    OH_LOG_Print(LOG_APP, LOG_DEBUG, LOG_DOMAIN, "test : %{public}s", "PlaySegments");

    return nullptr;
}
static napi_value SetSubframe(napi_env env, napi_callback_info info) {
    size_t argc = 2;
    napi_value args[2] = {nullptr};

    napi_get_cb_info(env, info, &argc, args, nullptr, nullptr);

    OH_LOG_Print(LOG_APP, LOG_DEBUG, LOG_DOMAIN, "test : %{public}s", "SetSubframe");

    return nullptr;
}
static napi_value GetDuration(napi_env env, napi_callback_info info) {
    size_t argc = 2;
    napi_value args[2] = {nullptr};

    napi_get_cb_info(env, info, &argc, args, nullptr, nullptr);

    OH_LOG_Print(LOG_APP, LOG_DEBUG, LOG_DOMAIN, "test : %{public}s", "GetDuration");

    return nullptr;
}
static napi_value TriggerEvent(napi_env env, napi_callback_info info) {
    size_t argc = 2;
    napi_value args[2] = {nullptr};

    napi_get_cb_info(env, info, &argc, args, nullptr, nullptr);

    OH_LOG_Print(LOG_APP, LOG_DEBUG, LOG_DOMAIN, "test : %{public}s", "TriggerEvent");

    return nullptr;
}
static napi_value AddEventListener(napi_env env, napi_callback_info info) {
    size_t argc = 2;
    napi_value args[2] = {nullptr};

    napi_get_cb_info(env, info, &argc, args, nullptr, nullptr);

    OH_LOG_Print(LOG_APP, LOG_DEBUG, LOG_DOMAIN, "test : %{public}s", "AddEventListener");

    return nullptr;
}
static napi_value RemoveEventListener(napi_env env, napi_callback_info info) {
    size_t argc = 2;
    napi_value args[2] = {nullptr};

    napi_get_cb_info(env, info, &argc, args, nullptr, nullptr);

    OH_LOG_Print(LOG_APP, LOG_DEBUG, LOG_DOMAIN, "test : %{public}s", "RemoveEventListener");

    return nullptr;
}
static napi_value ChangeColor(napi_env env, napi_callback_info info) {
    size_t argc = 2;
    napi_value args[2] = {nullptr};

    napi_get_cb_info(env, info, &argc, args, nullptr, nullptr);

    OH_LOG_Print(LOG_APP, LOG_DEBUG, LOG_DOMAIN, "test : %{public}s", "ChangeColor");

    return nullptr;
}
static napi_value SetContentMode(napi_env env, napi_callback_info info) {
    size_t argc = 2;
    napi_value args[2] = {nullptr};

    napi_get_cb_info(env, info, &argc, args, nullptr, nullptr);

    OH_LOG_Print(LOG_APP, LOG_DEBUG, LOG_DOMAIN, "test : %{public}s", "SetContentMode");

    return nullptr;
}
static napi_value SetFrameRate(napi_env env, napi_callback_info info) {
    size_t argc = 2;
    napi_value args[2] = {nullptr};

    napi_get_cb_info(env, info, &argc, args, nullptr, nullptr);

    OH_LOG_Print(LOG_APP, LOG_DEBUG, LOG_DOMAIN, "test : %{public}s", "SetFrameRate");

    return nullptr;
}
static napi_value CleanCache(napi_env env, napi_callback_info info) {
    size_t argc = 2;
    napi_value args[2] = {nullptr};

    napi_get_cb_info(env, info, &argc, args, nullptr, nullptr);

    OH_LOG_Print(LOG_APP, LOG_DEBUG, LOG_DOMAIN, "test : %{public}s", "CleanCache");

    return nullptr;
}

EXTERN_C_START
static napi_value Init(napi_env env, napi_value exports) {
    napi_property_descriptor desc[] = {
        {"createNativeRoot", nullptr, CreateNativeRoot, nullptr, nullptr, nullptr, napi_default, nullptr},
        {"play", nullptr, Play, nullptr, nullptr, nullptr, napi_default, nullptr},
        {"stop", nullptr, Stop, nullptr, nullptr, nullptr, napi_default, nullptr},
        {"togglePause", nullptr, TogglePause, nullptr, nullptr, nullptr, napi_default, nullptr},
        {"destroy", nullptr, Destroy, nullptr, nullptr, nullptr, napi_default, nullptr},
        {"pause", nullptr, Pause, nullptr, nullptr, nullptr, napi_default, nullptr},
        {"goToAndStop", nullptr, GoToAndStop, nullptr, nullptr, nullptr, napi_default, nullptr},
        {"goToAndPlay", nullptr, GoToAndPlay, nullptr, nullptr, nullptr, napi_default, nullptr},
        {"setSegment", nullptr, SetSegment, nullptr, nullptr, nullptr, napi_default, nullptr},
        {"resetSegments", nullptr, ResetSegments, nullptr, nullptr, nullptr, napi_default, nullptr},
        {"resize", nullptr, Resize, nullptr, nullptr, nullptr, napi_default, nullptr},
        {"setSpeed", nullptr, SetSpeed, nullptr, nullptr, nullptr, napi_default, nullptr},
        {"setDirection", nullptr, SetDirection, nullptr, nullptr, nullptr, napi_default, nullptr},
        {"playSegments", nullptr, PlaySegments, nullptr, nullptr, nullptr, napi_default, nullptr},
        {"setSubframe", nullptr, SetSubframe, nullptr, nullptr, nullptr, napi_default, nullptr},
        {"getDuration", nullptr, GetDuration, nullptr, nullptr, nullptr, napi_default, nullptr},
        {"TriggerEvent", nullptr, TriggerEvent, nullptr, nullptr, nullptr, napi_default, nullptr},
        {"addEventListener", nullptr, AddEventListener, nullptr, nullptr, nullptr, napi_default, nullptr},
        {"removeEventListener", nullptr, RemoveEventListener, nullptr, nullptr, nullptr, napi_default, nullptr},
        {"changeColor", nullptr, ChangeColor, nullptr, nullptr, nullptr, napi_default, nullptr},
        {"setContentMode", nullptr, SetContentMode, nullptr, nullptr, nullptr, napi_default, nullptr},
        {"setFrameRate", nullptr, SetFrameRate, nullptr, nullptr, nullptr, napi_default, nullptr},
        {"cleanCache", nullptr, CleanCache, nullptr, nullptr, nullptr, napi_default, nullptr},
    };
    napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc);
    return exports;
}
EXTERN_C_END

static napi_module demoModule = {
    .nm_version = 1,
    .nm_flags = 0,
    .nm_filename = nullptr,
    .nm_register_func = Init,
    .nm_modname = "lottiec",
    .nm_priv = ((void *)0),
    .reserved = {0},
};

extern "C" __attribute__((constructor)) void RegisterEntryModule(void) { napi_module_register(&demoModule); }
